package types

import (
	"strconv"
)

// IsNumberStr 检查是否为数字字符串
func IsNumberStr(str string) bool {
	if str == "" {
		return false
	}
	return IsIntStr(str) && IsFloatStr(str)
}

// IsIntStr 检查是否为整型数字字符串
func IsIntStr(str string) bool {
	_, err := strconv.Atoi(str)
	return err == nil
}

// IsFloatStr 检查是否为浮点型数字字符串
func IsFloatStr(str string) bool {
	_, err := strconv.ParseFloat(str, 10)
	return err == nil
}
